package ${packageStr};
import lombok.Data;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import org.apache.commons.lang3.StringUtils;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import com.ruoyi.common.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;


@Data
@Slf4j
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("${tableName}")
/**${entity.tableComment} 实体*/
public class ${entityName} {
    <#list filedList as filed>
        /***${filed.comment}*/
        <#if "${filed.idFiled}"=="1">
            @TableId(value = "${filed.column}", type = IdType.AUTO)
             <#elseif "${filed.idFiled}"=="2">
                @TableId(value = "${filed.column}")
           <#-- <#else>
                @TableField("${filed.column}")-->
        </#if>

         <#if "${filed.exist}"=="1">
        @Excel(name = "${filed.comment}")
        <#elseif "${filed.exist}"=="2">
        @TableField(exist = false)
         </#if>
        private ${filed.javaType} ${filed.name};


    </#list>

    <#if methodList?? && methodList?size>0>
        <#list methodList  as  method>
            /**${method.comment}*/
            public ${method.javaType} ${method.getName}(){
                return this.${method.filed};
            }

            /**${method.comment}*/
            public void ${method.setName}(${method.javaType} ${method.filed}){
                return this.${method.filed} = ${method.filed};
            }
        </#list>
    </#if>

public void merge(${entityName} entity){
<#if methodList?? && methodList?size>0>
    <#list methodList  as  method>
        /**${method.comment}*/
        public ${method.javaType} ${method.getName}(){
        return this.${method.setName}(entity.${method.getName}());
        }


    </#list>
</#if>

}




private final static java.util.List<String> FILE_DESC_LIST = new java.util.ArrayList<>(${filedSize});
    static{

<#list filedList  as  filed>
    FILE_DESC_LIST.add("${filed.name}");
</#list>

}

private final static java.util.Set<String> DATE_FILES = new java.util.HashSet<>();
        static{
    <#if dateFileds?? && (dateFileds?size >0)>
        <#list dateFileds  as  dateFiled1>
            DATE_FILES.add("${dateFiled1}");
        </#list>
    </#if>
    }




        /**数据修改值描述（字段说明）*/
        public java.util.List<com.ruoyi.common.core.domain.entity.ToUpdateEntity> toUpdateParameter(${entityName} oldEntity){
         return com.ruoyi.common.utils.EntityUtil.toUpdateParameter(oldEntity,this,FILE_DESC_LIST,DATE_FILES);
        }

                            
       @Override
       public String toString() { return ${jsonUtilMethod}(this);}

       @com.alibaba.fastjson2.annotation.JSONField(serialize = false)
       public ${entityName} getEntity(){return this;}
}